package com.example.testproject.adapter

import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.example.testproject.R
import com.example.testproject.bean.CardStackBean
import com.example.testproject.ext.loadUrl
import com.example.testproject.utils.click
import com.example.testproject.utils.toast
import kotlinx.android.synthetic.main.item_card_stack.view.*

/**
 *
 * @ClassName: CardStackAdapter
 * @Author: android 超级兵
 * @CreateDate: 10/21/21$ 11:10 AM$
 * TODO
 */
class CardStackAdapter<T>(data: MutableList<CardStackBean<T>>) :
    BaseQuickAdapter<CardStackBean<T>, BaseViewHolder>(R.layout.item_card_stack, data) {
    override fun convert(helper: BaseViewHolder, item: CardStackBean<T>) {

        helper.itemView.imageView.loadUrl(item.imageUrl)

        helper
            .setText(R.id.tvTitle, item.title)
            .setText(R.id.tvContent, item.content)

        helper.itemView.click {
            "已收藏:${item.content}" toast mContext
        }
    }
}